package com.itheima.reggie.controller;

import com.itheima.reggie.common.ResultInfo;
import com.itheima.reggie.domain.Dish;
import com.itheima.reggie.domain.Setmeal;
import com.itheima.reggie.service.SetmealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@RestController
//展示套餐内容
public class SetmealController {
    @Autowired
    private SetmealService setmealService;
    @GetMapping("/setmeal/list")
    public ResultInfo findList(Long categoryId,Integer status){//接收参数
        //调用service
        List<Setmeal> setmealList=setmealService.findList(categoryId,status);
        //返回结果
        return ResultInfo.success(setmealList);

    }
    //展示套餐详情
    @GetMapping("/setmeal/dish/{id}")
    public ResultInfo show(@PathVariable("id") Long id){
        List< Dish> dishList =setmealService.show(id);
        return ResultInfo.success(dishList);

    }

}
